<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--<!DOCTYPE html>--%>
<%--<html lang="en">--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
    <head>
        <% String path = request.getContextPath();%>
        <meta charset="utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
        <meta name="description" content="" />
        <meta name="author" content="" />
        <title>Simple Sidebar - Start Bootstrap Template</title>
		
        <!-- Favicon-->
        <link rel="icon" type="image/x-icon" href="<%=path%>/img/256x.ico" />
		
        <!-- Core theme CSS (includes Bootstrap)-->
        <link href="<%=path%>/css/styles.css" rel="stylesheet" />
		
		<!-- 引入font-awesome -->
		<link href="https://cdn.bootcdn.net/ajax/libs/font-awesome/5.15.3/css/all.css" rel="stylesheet">
		
		<!-- 引入bootst图标库 -->
		<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.5.0/font/bootstrap-icons.css">
		
    </head>
    <body>
        <div class="d-flex" id="wrapper">
            <!-- Sidebar-->
            <div class="border-end bg-white text-center" id="sidebar-wrapper">
                <div class="sidebar-heading border-bottom bg-light">czcBlog 后台管理</div>
                <div class="list-group list-group-flush">
                    <a class="list-group-item list-group-item-action list-group-item-light p-3" href="${pageContext.request.contextPath}/articleOption/allArticle">文章 <i class="fa fa-file"></i></a>
                    <a class="list-group-item list-group-item-action list-group-item-light p-3" href="${pageContext.request.contextPath}/comment.jsp">评论 <i class="fa fa-comments"></i></a>
                    <a class="list-group-item list-group-item-action list-group-item-light p-3" href="${pageContext.request.contextPath}/linksOption/allLinks">友链 <i class="fa fa-link"></i> </a>
<!--                    <a class="list-group-item list-group-item-action list-group-item-light p-3" href="#!">用户 <i class="fa fa-user"></i> </a>-->
                    <a class="list-group-item list-group-item-action list-group-item-light p-3" href="${pageContext.request.contextPath}/settings.jsp">设置 <i class="fa fa-cog"></i></a>
					<!-- 分割线 -->
					<div class="dropdown-divider"></div>
					
                </div>
            </div>
            <!-- Page content wrapper-->
            <div id="page-content-wrapper">
                <!-- Top navigation-->
                <nav class="navbar navbar-expand-lg navbar-light bg-light border-bottom">
                    <div class="container-fluid">
                        <button class="btn btn-primary" id="sidebarToggle"><i class="fa fa-caret-left"></i> 收起</button>
                        <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"><span class="navbar-toggler-icon"></span></button>
                        <div class="collapse navbar-collapse" id="navbarSupportedContent">
                            <ul class="navbar-nav ms-auto mt-2 mt-lg-0">
                                <li class="nav-item active"><a class="nav-link" href="${pageContext.request.contextPath}/articleOption/indexArticle"><i class="fa fa-home"></i> 返回首页</a></li>
                                <li class="nav-item dropdown">
                                    <a class="nav-link dropdown-toggle" id="navbarDropdown" href="#" role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fa fa-user-md"></i> 账户</a>
                                    <div class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdown">
                                        <a class="dropdown-item" href="${pageContext.request.contextPath}/loginCheck/loginOut"><i class="bi bi-box-arrow-left"></i> 登出</a>
                                        <div class="dropdown-divider"></div>
                                        <a class="dropdown-item" href="#!">没想好</a>
                                    </div>
                                </li>
                            </ul>
                        </div>
                    </div>
                </nav>
                <!-- Page content-->
                <div class="container-fluid">
					<h1 class="mt-4">文章</h1><a class="btn btn-primary" id="article-btn" href="${pageContext.request.contextPath}/article_add.jsp"><i class="bi bi-pencil"></i> 写文章</a>
                    <table class="table table-hover table-striped">
						<thead>
							<tr>
								<th>文章标题</th>
								<th>发布日期</th>
								<th>分类名称</th>
								<th>文章标签</th>
								<th>评论总数</th>
								<th>操作</th>
							</tr>
						</thead>
						
						<tbody>
                            <c:forEach var="article" items="${list}">
                                <tr>
                                    <td>${article.title}</td>
                                    <td>${article.publish_date}</td>

                                    <td>${article.category_name}</td>
                                    <td>${article.tag_name}</td>
                                    <td>${article.visited_times}</td>
                                    <td>
                                        <a href="${pageContext.request.contextPath}/articleOption/modifyArticle?art_id=${article.id}">修改</a>
                                        &nbsp; | &nbsp;
                                        <a href="${pageContext.request.contextPath}/articleOption/deleteArticle?art_id=${article.id}">删除</a>
                                    </td>
                                </tr>
                            </c:forEach>

						</tbody>
					</table>
                </div>
            </div>
        </div>
        <!-- Bootstrap core JS-->
        <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.0/dist/js/bootstrap.bundle.min.js"></script>
        <!-- Core theme JS-->
        <script src="js/scripts.js"></script>
    </body>
</html>
